{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2 \n",
    "# 1.文件的读取  2.封装格式解析  3.数据解码  4.数据加载\n",
    "img = cv2.imread('../../imags/test.jpeg',1)  #read image 2 args, 1: name,2 : 0 gray 1 color\n",
    "cv2.imshow('image',img)\n",
    "# jpg png  图片文件有两部分组成：1.文件头  2.文件数据（压缩后的数据0）0\n",
    "cv2.waitKey(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import cv2\n",
    "img = cv2.imread('../../imags/test.jpeg',1)\n",
    "cv2.imwrite('../../imags/image.png',img)   # imwrite 2args,1:name ,2 imag data"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
